/**
 * 
 */
package defi4;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * @author Logan
 *
 */
public class CycleLettre {

	public List<Integer> cycles;

	public CycleLettre() {
		cycles = new ArrayList<Integer>();
	}
	
	public void trier() {
		Collections.sort(cycles);
	}

	public String toString() {
		if(cycles != null && !(cycles.size() == 0)) {
			String res = "<" + cycles.get(0);
			for(int i = 1; i<cycles.size(); i++) {
				res += "," + cycles.get(i);
			}
			res += ">";
			return res;
		}
		return "";
	}
	
	public boolean equals(Object o) {
		CycleLettre tmp = (CycleLettre) o;
		
		if(cycles.size() != tmp.cycles.size()) {
			return false;
		}
		
		for(int i = 0; i<cycles.size(); i++) {
			if(!cycles.get(i).equals(tmp.cycles.get(i))) {
				return false;
			}
		}
		
		return true;
	}

}
